<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:p="http://primefaces.org/ui" lang="pt-br">
<body>

	<ui:composition template="template/template.xhtml">

		<ui:define name="titulo">
			Loja Virtual
		</ui:define>

		<ui:define name="conteudo">

			<p:carousel id="carProdutos" value="#{lojaController.todosProdutos}"
				var="item"
				itemStyle="width:220px; height: 180px; padding:0px; margin:2px; ">

				<f:facet name="header">  
			            Produtos  
			    </f:facet>
				<p:column width="10">

					<h:panelGrid columns="1">
						<h:outputText value="#{item.prodNome}" styleClass="title" />
						<h:panelGrid columns="2">
							<p:graphicImage value="/thumbs/#{item.imagem}" />
							<h:panelGrid columns="1">
								<h:outputText value="#{item.descPeq}" tyleClass="text" />

								<h:panelGroup>
									<h:outputText value="#{item.desconto > 0 ? 'Lista:':'Preco:'}"
										styleClass="text" />
									<h:outputText value="#{item.preco}"
										styleClass="#{item.desconto > 0 ? 'listprice':'text'}">
										<f:convertNumber type="currency" />
									</h:outputText>
								</h:panelGroup>

								<h:panelGroup rendered="#{item.desconto>0}">
									<h:outputText value="Preco:" styleClass="text" />
									<h:outputText
										value="#{item.preco-(item.preco*item.desconto)/100}"
										styleClass="price">
										<f:convertNumber type="currency" />
									</h:outputText>
								</h:panelGroup>

								<h:panelGroup rendered="#{item.desconto>0}">
									<h:outputText value="Economize:" styleClass="text" />
									<h:outputText value="#{(item.preco*item.desconto)/100}"
										styleClass="price">
										<f:convertNumber type="currency" />
									</h:outputText>
								</h:panelGroup>
								<h:panelGroup>
									<h:outputText value="Categoria:" styleClass="text" />
									<h:outputText value="#{item.cat.catNome}" styleClass="text" />
								</h:panelGroup>

								<h:outputLink value="detalhes.jsf?id=#{item.id}">
									<h:outputText value="Mais detalhes aqui" styleClass="text" />
								</h:outputLink>

								<h:commandLink
									action="#{carrinhoController.adicionarAoCarrinho}">
									<h:outputText value="Adicionar ao carrinho" styleClass="text" />
									<f:param name="id" value="#{item.id}" />
								</h:commandLink>
							</h:panelGrid>
						</h:panelGrid>
					</h:panelGrid>

				</p:column>
				<f:facet name="footer">  
					            Total de 10 produtos.  
					    </f:facet>
			</p:carousel>
		</ui:define>



	</ui:composition>

</body>
</html>
